﻿<!-- #include file="function.asp" -->
<%
'注册插件
Call RegisterPlugin("xnxf_AD","ActivePlugin_xnxf_AD")
'挂口部分
Dim AD_path
AD_path = BlogPath & "zb_users\PLUGIN\xnxf_AD\.cfg\"

Dim AD_cfg
AD_cfg = BlogPath & "zb_users\PLUGIN\xnxf_AD\.cfg\" & ZC_BLOG_CLSID

Function ActivePlugin_xnxf_AD()
	Call Add_Filter_Plugin("Filter_Plugin_TArticleList_Build_Template","AD_Run")
	Call Add_Filter_Plugin("Filter_Plugin_TArticleList_Build_Template_Succeed","AD_Run")
	Call Add_Filter_Plugin("Filter_Plugin_TArticle_Export_Template","AD_Run2")
	Call Add_Filter_Plugin("Filter_Plugin_TArticle_Build_Template","AD_Run")
	Call Add_Filter_Plugin("Filter_Plugin_TArticle_Build_Template_Succeed","AD_Run")
End Function

Function AD_Run(ByRef html)
  html = AD_Replace(html)
End Function

Function AD_Run2(ByRef html,ByRef subhtml)
  html = AD_Replace(html)
  subhtml = AD_Replace(subhtml)
End Function

Function AD_Replace(ByVal html)
  Dim m,n,xnxf_AD_ary,xnxf_AD_arySub,s
  s = html

  xnxf_AD_ary = Split(LoadFromFile(AD_cfg,"utf-8"),"xfxn")

  For m = 0 to Ubound(xnxf_AD_ary)
    xnxf_AD_arySub = Split(xnxf_AD_ary(m),"xnxf")
    if instr(s,Replace(xnxf_AD_arySub(1),xnxf_AD_arySub(0),"")) = 0 Then
      s = Replace(s,xnxf_AD_arySub(0),xnxf_AD_arySub(1))
    End If
  Next
  AD_Replace = s
End Function


Function InstallPlugin_xnxf_AD()
  If Not PublicObjFSO.FolderExists(AD_path) Then 'PublicObjFSO.FileExists(AD_cfg)
    Call CreatDirectoryByCustomDirectoryWithFullBlogPath(AD_path)
    Call SaveToFile(AD_cfg,"</head>xnxf<!-- 要插入网页的内容 --></head>xnxf备注说明","utf-8",False)
  End If
End Function


Function UnInstallPlugin_xnxf_AD()

	'用户停用插件之后的操作

End Function
%>